package com.lefevre.cms.bean.feedback;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 在线留言
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("feedback")
@Entity
@Table(indexes = {@Index(name = "feedback_1_idx", columnList = "createDate")})
public class Feedback implements Serializable {
    private static final long serialVersionUID = -4891301979499383115L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @TableId(type = IdType.INPUT)
    private Long id;

    /**
     * 名称
     **/
    @Column(length = 190)
    @TableField("`name`")
    private String name;

    /**
     * 联系方式
     **/
    @Column(length = 190)
    @TableField("contact")
    private String contact;

    /**
     * 内容
     **/
    @Lob
    @TableField("`content`")
    private String content;

    /**
     * IP
     **/
    @Column(length = 45)
    @TableField("ip")
    private String ip;

    /**
     * IP归属地
     **/
    @Transient
    @TableField(exist = false)
    private String ipAddress;

    /**
     * 创建时间
     **/
    @Temporal(TemporalType.TIMESTAMP)
    @TableField("createDate")
    private Date createDate = new Date();

}
